#include <cstdio>
#include <cassert>
#include <cstring>
using namespace std;

int main(int argc, char *argv[])
{

  FILE *fp;
  assert(argc == 2);
  if((fp = fopen(*++argv, "ab+")) == NULL) {
    fprintf(stderr,"can't create/open file %s\n", *argv);
    return 1;
  }
  fputs("hahaha\n",fp);
  
  char str[100];
  fgets(str,100,fp);
  printf("strlen(str) = %d\n",strlen(str));

  fclose(fp);


  return 0;
}
